﻿using System;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using Ah.Testudin.Engine.Actors;

namespace Ah.Testudin.Engine.Graphics.Scenes.SceneNodes
{
    public class SpriteSceneNode : SceneNodeBase
    {
        #region Private Member Variables

        private readonly Texture2D _texture;

        private readonly Rectangle _rectangle;

        #endregion

        #region Constructors

        public SpriteSceneNode(
            ActorId actorId,
            RenderPass renderPass,
            Matrix toWorldTransform,
            Texture2D texture,
            Rectangle rectangle)
            : base("Sprite", actorId, renderPass, toWorldTransform)
        {
            _texture = texture;

            _rectangle = rectangle;
        }

        #endregion

        #region Overrides

        public override void PreRender(Scene scene)
        {
            base.PreRender(scene);
        }

        public override void Render(Scene scene)
        {
            scene.Renderer.RenderSprite(
                _rectangle,
                _texture);
        }

        public override void PostRender(Scene scene)
        {
            base.PostRender(scene);
        }

        #endregion
        
    }
}
